//创建登陆界面
function createLoginInterface(){
  $("#loginDivPanel").dialog({
     width: 400,
     resizable: false
  });
  $("#loginDiv").html("");
  new Ext.Panel({
		renderTo:"loginDiv",
		title:"用户登录界面",
		width:388,
		layout:"form",
		hideLabels:false,
		labelAlign:"right",
		height:120,
		style:'margin-left: -18',
		defaultType: 'textfield',
		modal: true,
		items:[
			{fieldLabel:"用户账号",xtype:"textfield",name:"userName",style:'margin-top: 2'},
			{fieldLabel:"用户密码",inputType:"password",name:"userPassword"}
			],
		  buttons:[
		            {text:'注册',handler:function(){createRegisterInterface();}},
		            {text:'登录',handler:function(){login();}}
		          ] 
		 }
		 
		);
  $("#loginDivPanel").css("height","260");
}
//登陆方法
function login(){
  var userName = $("input[name='userName']").val();
  var userPassword = $("input[name='userPassword']").val();
  if(userName == ""){
    showMessage("用户账号不能为空","error");
    return;
  } 
  if(userPassword == ""){
    showMessage("用户密码不能为空","error");
    return;
  }
  $.ajax({
     type: "POST",
     async: false,
     url: "login.action",
     data:"userVO.userName=" + userName + "&userVO.userPassword=" + userPassword,
     success: function(result){
         if(result == "yes"){
	         $("#loginInfo").html("欢迎您：" + userName + "<a href='javascript:exit()'>退出登陆</a>");
	         $("#loginDivPanel").dialog("close");
	         
         }else{
            showMessage("对不起，您输入的账号不存在！","error");
         }
         showSystemErrorMsg(result);
     }
  });
}

//初始化用户信息
function initUserInfo(){
   $.ajax({
      url:"getCurUserName.action",
      type:"GET",
      async: false,
      success: function(result){
      
      }
   })
}


